<?php

/**
 * Estudiantes filter form base class.
 *
 * @package    Fix_Student
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseEstudiantesFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cedula'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'matricula'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nombres'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellidos'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fechadenacimiento' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'direccion'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'telefono'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sexo'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idcurso'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cursos'), 'add_empty' => true)),
      'idcarrera'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Carreras'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'cedula'            => new sfValidatorPass(array('required' => false)),
      'matricula'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nombres'           => new sfValidatorPass(array('required' => false)),
      'apellidos'         => new sfValidatorPass(array('required' => false)),
      'fechadenacimiento' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'direccion'         => new sfValidatorPass(array('required' => false)),
      'telefono'          => new sfValidatorPass(array('required' => false)),
      'email'             => new sfValidatorPass(array('required' => false)),
      'sexo'              => new sfValidatorPass(array('required' => false)),
      'idcurso'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Cursos'), 'column' => 'idcurso')),
      'idcarrera'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Carreras'), 'column' => 'idcarrera')),
    ));

    $this->widgetSchema->setNameFormat('estudiantes_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Estudiantes';
  }

  public function getFields()
  {
    return array(
      'idestudiante'      => 'Number',
      'cedula'            => 'Text',
      'matricula'         => 'Number',
      'nombres'           => 'Text',
      'apellidos'         => 'Text',
      'fechadenacimiento' => 'Date',
      'direccion'         => 'Text',
      'telefono'          => 'Text',
      'email'             => 'Text',
      'sexo'              => 'Text',
      'idcurso'           => 'ForeignKey',
      'idcarrera'         => 'ForeignKey',
    );
  }
}
